export * from './theme';
import uuid from 'react-native-uuid';
import {getItem, removeItem, setItem} from './asyncStorage';
import {SEARCH_HISTORY, TOKEN} from './const';

export function generateUUid() {
  return uuid.v4().toString().replaceAll('-', '');
}

export function getToken() {
  return getItem(TOKEN);
}
export async function delToken() {
  return await removeItem(TOKEN);
}

export async function getSearchHistory() {
  const his = await getItem(SEARCH_HISTORY);
  return his[SEARCH_HISTORY];
}
export async function saveSearchHistory(his: any[]) {
  return await setItem(SEARCH_HISTORY, {[SEARCH_HISTORY]: his});
}
export async function delSearchHistory() {
  return await removeItem(SEARCH_HISTORY);
}
